package com.androidproject.modele;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.androidproject.Item;
import com.androidproject.R;
import com.androidproject.LineArrayAdapter.RowType;

public class Programme implements Item {
	
	private String hour;
	private String logoname;
	private String channel;
	private String game;
	
	public Programme(String hour, String logoname, String channel, String game) {
		this.hour = hour;
		this.logoname = logoname;
		this.channel = channel;
		this.game = game;
	}

	public String getHour() {
		return hour;
	}

	public String getLogoname() {
		return logoname;
	}

	public String getChannel() {
		return channel;
	}

	public String getGame() {
		return game;
	}

	@Override
	public int getViewType() {
		return RowType.LIST_ITEM.ordinal();
	}

	@Override
	public View getView(LayoutInflater inflater, View convertView) {
		 View view;
	        if (convertView == null) {
	            view = (View) inflater.inflate(R.layout.activity_programme_tv_journee, null);
	        } else {
	            view = convertView;
	        }

			ImageView image = (ImageView) view.findViewById(R.id.imageGaucheProgramme);
			if(logoname.equals("canal_plus_sport")){
				image.setImageResource(R.drawable.canal_plus_sport);
			} else if(logoname.equals("bein_sport")){
				image.setImageResource(R.drawable.bein_sport);
			}
			
			((TextView) view.findViewById(R.id.textHeure)).setText(hour);
			((TextView) view.findViewById(R.id.textprogrammeChaine)).setText(game + " sur " + channel);
			
	        return view;
	}

}
